import sys
import pygame
from Settings import Settings
from ship import Ship
from alien import Alien
import game_functions as gf
from pygame.sprite import Group 

def run_game():
	settings = Settings()
	bullets = Group()
	aliens = Group()


	pygame.init()
	screen = pygame.display.set_mode((settings.screen_width,settings.screen_height))
	pygame.display.set_caption("Alien Invasion")

	ship = Ship(screen)
	num=0

	gf.creat_fleet(settings,screen,aliens)

	while True:
		#事件监听
		gf.check_events(ship, bullets,screen,settings)

		#更新屏幕
		gf.update_screen(screen,ship,settings, bullets, num,aliens)
		num += 1
		if num==15:
			num=0


run_game()